//wrong answer
#include <cstdio>
#include <cmath>
#include <iostream>

//using namespace std;

int v[4][2]={{-1,0},{0,1},{1,0},{0,-1}};
char ord[4]={'N','E','S','W'};
int dir=0, m, n,i,j,x, y, a;
char cmd, grid[62][62];
char nada[100];


void process(){
	
	dir=0;
	scanf("%d %d\n", &m, &n);
	m++;n++;
	for(i=0;i<=n;i++)grid[0][i]=0;
	for(i=0;i<=n;i++)grid[m][i]=0;
	for(i=1;i<m;i++)grid[i][0]=0;
	for(i=1;i<m;i++)grid[i][n]=0;
	
	for(i=1;i<m;i++){
		for(j=1;j<n;j++)scanf("%c", &grid[i][j]);
		//scanf("%c", &cmd);
		gets(nada);
	}
	scanf("%d %d\n", &y, &x);
	scanf("%c", &cmd);
	while(cmd!='Q'){
		switch(cmd){
			case 'R': dir = ++dir%4; break;
			case 'L': if(--dir==-1)dir=3; break;
			case 'F':
					x+=v[dir][1];
					y+=v[dir][0];
					if(grid[y][x]=='*'||grid[y][x]==0){
						x-=v[dir][1];
						y-=v[dir][0];
					}
					break;
		}
		scanf("%c", &cmd);
	}
	
	printf("%d %d %c\n", y, x, ord[dir]);
}


int main(){
	freopen("in.txt", "r", stdin);//freopen("out.txt", "w", stdout);
	scanf("%d", &a);
	while(a--){
		process();
	}

return 0;
}
